using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class PKT_ItemActivityMap : EntityTypeConfiguration<PKT_ItemActivity>
    {
        public PKT_ItemActivityMap()
        {
            // Primary Key
            this.HasKey(t => new { t.spid, t.id });

            // Properties
            this.Property(t => t.spid)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.Period)
                .HasMaxLength(50);

            this.Property(t => t.item)
                .HasMaxLength(50);

            this.Property(t => t.Item_desc)
                .HasMaxLength(100);

            this.Property(t => t.Location)
                .HasMaxLength(50);

            this.Property(t => t.Transaction_Type)
                .HasMaxLength(50);

            this.Property(t => t.Document__)
                .HasMaxLength(50);

            this.Property(t => t.Customer_Name)
                .HasMaxLength(50);

            this.Property(t => t.Customer_ID)
                .HasMaxLength(50);

            this.Property(t => t.Salesman)
                .HasMaxLength(50);

            this.Property(t => t.Item_type)
                .HasMaxLength(50);

            this.Property(t => t.Item_Category)
                .HasMaxLength(50);

            this.Property(t => t.Costcenter)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("PKT_ItemActivity");
            this.Property(t => t.spid).HasColumnName("spid");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.Period).HasColumnName("Period");
            this.Property(t => t.item).HasColumnName("item");
            this.Property(t => t.Item_desc).HasColumnName("Item_desc");
            this.Property(t => t.Location).HasColumnName("Location");
            this.Property(t => t.expiry_Date).HasColumnName("expiry_Date");
            this.Property(t => t.Transaction_Type).HasColumnName("Transaction_Type");
            this.Property(t => t.quantity).HasColumnName("quantity");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Document__).HasColumnName("Document_#");
            this.Property(t => t.Customer_Name).HasColumnName("Customer_Name");
            this.Property(t => t.Customer_ID).HasColumnName("Customer_ID");
            this.Property(t => t.Salesman).HasColumnName("Salesman");
            this.Property(t => t.Item_type).HasColumnName("Item_type");
            this.Property(t => t.Item_Category).HasColumnName("Item_Category");
            this.Property(t => t.Cost).HasColumnName("Cost");
            this.Property(t => t.Costcenter).HasColumnName("Costcenter");
            this.Property(t => t.Inventory).HasColumnName("Inventory");
        }
    }
}
